package com.googlecode.lookie.platform.state;

import java.io.File;
import java.io.IOException;

public class DefaultStateLocation
    implements StateLocation
{

    private File root;

    public DefaultStateLocation()
    {
        super();
    }

    public DefaultStateLocation( File root )
    {
        super();
        this.root = root;
    }

    public File getRoot()
    {
        return root;
    }

    public void setRoot( File root )
    {
        this.root = root;
    }

    public File getFile( String namespace, String name )
        throws IOException
    {
        return new File( getDirectory( namespace ), name );
    }

    public File getDirectory( String namespace )
        throws IOException
    {
        File nsDir = new File( root, namespace );
        return nsDir;
    }

}
